<template>
	<div class="help">
		<div class="helpCont">
			<u-collapse @change="change" @close="close" @open="open">
				<u-collapse-item :title="ite.question" name="Docs guide" v-for="(ite,idx) in helpList" :key="idx">
					<!-- <text class="u-collapse-content"> {{ite.answer}} </text> -->
					<rich-text :nodes="ite.content"></rich-text>
				</u-collapse-item>

			</u-collapse>
		</div>
	</div>
</template>




<script>
	export default {
		data() {
			return {
				helpList: [],
				anchor_id: uni.getStorageSync('author_id'),
			}
		},
		mounted() {
			this.getContractList()
		},
		methods: {
			async getContractList() {
				const {
					data
				} = await this.$request(this.$Api.userQuestion, {
					anchor_id: this.anchor_id
				}, "POST")
				if (data.code !== 0) return
				for (var i in data.data.list) {
					var richtext = data.data.list[i].answer;
					const regex = new RegExp('<img', 'gi');
					richtext = richtext.replace(regex, `<img style="max-width: 100%;"`)
					data.data.list[i].content = richtext
				}
				this.helpList = data.data.list
			},
			open(e) {
				// console.log('open', e)
			},
			close(e) {
				// console.log('close', e)
			},
			change(e) {
				// console.log('change', e)
			}
		}
	}
</script>
<style lang="less">
	.help {
		padding: 24rpx 0;
	}

	.helpCont {
		background: #fff;
		word-wrap: break-word;
	}
</style>